package iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TestIterator {
    public static void main(String[] s) {
        Student student1=new Student("xcy",20,12);
        Student student2=new Student("xcy",13,20);
        Student student3=new Student("xcy",19,20);
        List listStudents=new ArrayList();
        listStudents.add(student1);
        listStudents.add(student2);
        listStudents.add(student3);
        //原始
        Iterator it =listStudents.iterator();
        while (it.hasNext())
        {
            System.out.println(it.next());
        }
        int a[]={1,1,1,1,};

/*        //增强for循环
        for (Object student:listStudents)
        {
            System.out.println(student);

        }*/
    }
}
